<?php
declare(strict_types=1);
namespace cms\system\admin\api_controller;

use cms\system\service\AdminService;
use Hyperf\Di\Annotation\Inject;
use Hyperf\HttpServer\Annotation\Controller;
use Hyperf\HttpServer\Annotation\PostMapping;
use HyperfExt\Auth\Contracts\AuthManagerInterface;

/**
 * Class AuthController
 * @package cms\system\admin\api_controller
 * @Controller(prefix="api/system/admin_auth")
 */
class AuthController extends AbstractController
{
    /**
     * @Inject()
     * @var AdminService
     */
    protected AdminService $adminService;
    /**
     * @PostMapping(path="login")
     */
    public function login()
    {
        $credentials = $this->request->inputs(['username', 'password']);
        $auth = make(AuthManagerInterface::class)->guard('admin')->attempt($credentials);
        var_dump($auth);
    }
}